{extend name='admin@public/content'}

{block name="button"}
<!--{if auth("$classuri/add")}-->
<button data-modal='{:url("@$classuri/add")}' data-title="添加等级" class='layui-btn layui-btn-sm layui-btn-primary'>添加等级
</button>
<!--{/if}-->
<!--{if auth("$classuri/del")}-->
<!--{/if}-->
{/block}

{block name="content"}


<form autocomplete="off" class="layui-form layui-form-pane form-search" action="{:request()->url()}"
      onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">地区名称</label>
        <div class="layui-input-inline">
            <input name="area_name" value="{$Think.get.area_name}" placeholder="请输入地区名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

</form>


<form autocomplete="off" onsubmit="return false;" data-auto="true" method="post">
    <!--{if empty($list)}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none="none" data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='text-left nowrap'>ID</th>
            <th class='text-left nowrap'>区域名称</th>
            <th class='text-left nowrap'>区域代理人</th>
            <th class='text-center nowrap'>区域管理</th>
            <th class='text-center'></th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td think-checkbox'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
            </td>
            <td class='text-left nowrap'>
                <span class="color-desc">{$vo.id}</span>
            </td>
            <td class='text-left nowrap'>
                <span class="color-desc">{$vo.area_name}</span>
            </td>
            <td class='text-left nowrap'>
                <span class="color-desc">{$vo.name|default="暂无代理人"}</span>
            </td>
            <td class='text-center nowrap'>

                {if $vo.area_parent_id}

                {if !$vo.status}

                <a data-title="添加绑定" data-modal='{:url("@$classuri/add_add")}?id={$vo.id}' style="color: green;">添加</a>
                <span class="text-explode">|</span>

                {else}
                <a data-update="{$vo.id}" data-action='{:url("$classuri/del_add")}?id={$vo.id}' style="color: red;">解除</a>
                <span class="text-explode">|</span>
                {/if}
                <?php $a = substr($vo['id'],-1,1); ?>
                <?php $b = substr($vo['id'],-2,1); ?>

                {if !$a and !$b}

                <a data-open='{:url("@$classuri/address")}?id={$vo.id}'>下级</a>
                <span class="text-explode">|</span>

                {/if}
                <a href="javascript:history.go(-1)">上级</a>
                {else}
                <a data-open='{:url("@$classuri/address")}?id={$vo.id}'>下级</a>
                {/if}

            </td>
            <td></td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    <!--{/if}-->
</form>
{/block}